home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / X11R4 / cmds / X / ddx / mfb / RCS / mfbmisc.c,v < prev    next >
Encoding:
Text File  |  1990-02-15  |  2.2 KB  |  87 lines

  1. head     1.1;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.1
  10. date     90.02.14.19.58.15;  author tve;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @Original X11R4 distribution
  17. @
  18.  
  19.  
  20.  
  21. 1.1
  22. log
  23. @Initial revision
  24. @
  25. text
  26. @/***********************************************************
  27. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
  28. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  29.  
  30.                         All Rights Reserved
  31.  
  32. Permission to use, copy, modify, and distribute this software and its 
  33. documentation for any purpose and without fee is hereby granted, 
  34. provided that the above copyright notice appear in all copies and that
  35. both that copyright notice and this permission notice appear in 
  36. supporting documentation, and that the names of Digital or MIT not be
  37. used in advertising or publicity pertaining to distribution of the
  38. software without specific, written prior permission.  
  39.  
  40. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  41. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  42. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  43. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  44. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  45. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  46. SOFTWARE.
  47.  
  48. ******************************************************************/
  49. /* $XConsortium: mfbmisc.c,v 5.0 89/06/09 15:06:49 keith Exp $ */
  50. #include "X.h"
  51. #include "misc.h"
  52. #include "cursor.h"
  53. #include "screenint.h"
  54.  
  55. #include "mfb.h"
  56.  
  57. /*ARGSUSED*/
  58. void
  59. mfbQueryBestSize(class, pwidth, pheight)
  60. int class;
  61. short *pwidth;
  62. short *pheight;
  63. {
  64.     unsigned width, test;
  65.  
  66.     switch(class)
  67.     {
  68.       case TileShape:
  69.       case StippleShape:
  70.       width = *pwidth;
  71.       /* Return the closes power of two not less than what they gave me */
  72.       test = 0x80000000;
  73.       /* Find the highest 1 bit in the width given */
  74.       while(!(test & width))
  75.          test >>= 1;
  76.       /* If their number is greater than that, bump up to the next
  77.        *  power of two */
  78.       if((test - 1) & width)
  79.          test <<= 1;
  80.       *pwidth = test;
  81.       /* We don't care what height they use */
  82.       break;
  83.     }
  84. }
  85.  
  86. @
  87.